YAHOO.namespace('Tesis');

YAHOO.Tesis.ListTableBase = function(elContainer, columnDefs, dataSource, config) {
    this.accionesTooltip = new YAHOO.widget.Tooltip("acciones_tooltip");
    YAHOO.Tesis.ListTableBase.superclass.constructor.call(this, elContainer,
    columnDefs, dataSource, config);
};

YAHOO.lang.extend(YAHOO.Tesis.ListTableBase, YAHOO.widget.DataTable, {
    
    setAccionTooltip : function(element, filter, body, displayTimeout){        
        var self = this;        
        element.delegate('mouseover', function() {
            var x= arguments[0].clientX,
                y= arguments[0].clientY,
                tooltip = self.accionesTooltip;
            
            self.showAccionesTooltipTimer = window.setTimeout(function() {
                tooltip.setBody(body);
                tooltip.cfg.setProperty('xy',[x + 10,y + 10]);
                tooltip.show();
                if(displayTimeout){
                    self.hideAccionesTooltipTimer = window.setTimeout(function() {
                        tooltip.hide();
                    },displayTimeout);
                }
            },10);            
        }, filter);
        
        element.delegate('mouseout', function() {
            if (self.showAccionesTooltipTimer ) {
                window.clearTimeout(self.showAccionesTooltipTimer );
                self.showAccionesTooltipTimer  = 0;
            }
            if (self.hideAccionesTooltipTimer) {
                window.clearTimeout(self.hideAccionesTooltipTimer);
                self.hideAccionesTooltipTimer = 0;
            }
            self.accionesTooltip.hide();            
        }, filter);  
    }    
});